package com.wn.production.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wn.common.PageBean;
import com.wn.entity.MonthlyPlan;
import com.wn.production.mapper.MonthlyPlanMapper;
import com.wn.production.service.MonthlyPlanService;
import com.wn.production.vo.MonthlyPlanVo;
import com.wn.utils.PageBeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MonthlyPlanMapperImpl implements MonthlyPlanService {
    @Autowired
    private MonthlyPlanMapper monthlyPlanMapper;
    @Override
    public void insert(MonthlyPlan monthlyPlan) {
        monthlyPlanMapper.insert(monthlyPlan);
    }

    @Override
    public PageBean<MonthlyPlan> getByCondition(MonthlyPlanVo monthlyPlanVo) {
        Page<MonthlyPlan> page = PageHelper.startPage(monthlyPlanVo.getCurrPage(), monthlyPlanVo.getPageSize());
        List<MonthlyPlan> list = monthlyPlanMapper.getByCondition(monthlyPlanVo.getMonthlyPlan());
        return PageBeanUtil.getPageBean(list,page,monthlyPlanVo.getCurrPage(),monthlyPlanVo.getPageSize());
    }
}
